package com.zhuozhou.jdyc.main.goods.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.zhuozhou.jdyc.base.BaseViewModel;
import com.zhuozhou.jdyc.main.goods.bean.BasicsCommentDetailsBase;
import com.zhuozhou.jdyc.main.goods.bean.BasicsCommodityBase;
import com.zhuozhou.jdyc.main.main.bean.BasicsCitySearchBean;
import com.zhuozhou.jdyc.main.main.bean.BasicsCommodityTypeBean;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Create by Once_ChuXy on 2021/9/5
 * Describe:商品
 */
public class GoodsViewModel extends BaseViewModel {
    public GoodsViewModel(@NonNull Application application) {
        super(application);
        setShowDialog(false);
    }

    public MutableLiveData<String> pathImgMutableLiveData = new MutableLiveData<>();

    public void getPathImg(int type, String id, int user_id) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("type", type);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getPathImg(map), true, pathImgMutableLiveData);
    }

    public MutableLiveData<BasicsCommodityBase> BasicsCommodityMutableLiveData = new MutableLiveData<>();

    public void getBasicsCommodity(String type, String id, int user_id) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("type", type);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getBasicsCommodity(map), true, BasicsCommodityMutableLiveData);
    }

    public void getJiFenCommodity(String type, String id, int user_id) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("type", type);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getJiFenCommodity(map), true, BasicsCommodityMutableLiveData);
    }

    public void getYiHuoCommodity(String type, String id, int user_id) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("type", type);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getYiHuoCommodity(map), true, BasicsCommodityMutableLiveData);
    }

    public MutableLiveData<BasicsCitySearchBean> BasicsCollectionMutableLiveData = new MutableLiveData<>();

    public void getBasicsCollection(int type, String commodity_id, int user_id) {
        Map map = new HashMap();
        map.put("commodity_id", commodity_id);
        map.put("type", type);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getBasicsCollection(map), true, BasicsCollectionMutableLiveData);
    }

    public MutableLiveData<List<BasicsCommodityTypeBean.ArrayBean>> BasicsTopDetailsMutableLiveData = new MutableLiveData<>();

    public void getBasicsTopDetails(String admin_id, String id, int num_type, int type) {
        Map map = new HashMap();
        map.put("admin_id", admin_id);
        map.put("id", id);
        map.put("num_type", num_type);
        map.put("type", type);
        observe(apiServiceHelper.getBasicsTopDetails(map), true, BasicsTopDetailsMutableLiveData);
    }

    public MutableLiveData<BasicsCitySearchBean> ShopGetDiscountMutableLiveData = new MutableLiveData<>();

    public void getShopGetDiscount(int admin_id, int discount_id, int user_id) {
        Map map = new HashMap();
        map.put("admin_id", admin_id);
        map.put("discount_id", discount_id);
        map.put("user_id", user_id);
        observe(apiServiceHelper.getShopGetDiscount(map), true, ShopGetDiscountMutableLiveData);
    }
    public MutableLiveData<BasicsCommentDetailsBase> BasicsCommentDetailsMutableLiveData = new MutableLiveData<>();

    public void getBasicsCommentDetails(Integer id, Integer type) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("type", type);
        observe(apiServiceHelper.getBasicsCommentDetails(map), true, BasicsCommentDetailsMutableLiveData);
    }

    public MutableLiveData<BasicsCitySearchBean> BasicsShoppingJoinMutableLiveData = new MutableLiveData<>();

    public void getBasicsShoppingJoin(Integer commodity_id, Integer admin_id, Integer user_id, String skustring, String sku, String goods_weight,
                                      String type, Integer number, Integer numberlist, Integer distribution, Integer store_id, Integer integral, Integer yihuo_integral
            , Integer shopId, String goods_no) {
        Map map = new HashMap();
        map.put("admin_id", admin_id);
        map.put("commodity_id", commodity_id);
        map.put("user_id", user_id);
        map.put("skustring", skustring);
        map.put("sku", sku);
        map.put("goods_weight", goods_weight);
        map.put("type", type);
        map.put("number", number);
        map.put("numberlist", numberlist);
        map.put("distribution", distribution);
        map.put("store_id", store_id);
        map.put("integral", integral);
        map.put("yihuo_integral", yihuo_integral);
        map.put("shopId", commodity_id);
        map.put("goods_no", goods_no);
        observe(apiServiceHelper.getBasicsShoppingJoin(map), true, BasicsShoppingJoinMutableLiveData);
    }
}
